package com.github.llyb120.dsl


class DataSetDsl extends AbstractDslMaker{

    protected DslParser createParser() {
        return parser{
            /** generator **/
            element "generator", {
                root true
                property "name"
                property "handler", {
                    type Closure
                }
            }

            element "datasource", {
                root true
                property "name"
                property "url"
                property "driver"
                property "username"
                property "password"
            }

            element "dataset", {
                root true
                property "name"
//                property "table"
                property "field", {
                    multiple true
                    type Object.class
                }
//                property "use", {
//                    type String
//                }
                property "scope", {
                    type Object
                }

                property "lead", {
                    type Object
                }
            }

            element "lead", {
                property "table"
                property "use"
            }

            element "field", {
                constructor "en", "cn", "converter"
                property "en"
                property "cn"
                property "converter"
            }



            element "converter", {
                root true
                property "name"
                property "input", {
                    type Closure
                }
                property "output", {
                    type Closure
                }
            }


            element "scope", {
                property "use"
                property "sql"
                property "group", {
                    type String[]
                }
            }

            element "quota", {
                root true
                property "name"
                property "calculate", {
                    type(Closure)
                }
            }





        }
    }
}

public static void main(String[] args) {
    new DataSetDsl()
            .generate("D:\\work\\cal-engine\\src\\main\\java\\com\\github\\llyb120\\performance\\define", "com.github.llyb120.performance.define")
}
